package com.yf.modules.system.controller;


import com.yf.modules.system.service.api.MonitorService;
import com.yf.response.ResponseBody;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author chentianwei
 * @date 2024-11-01
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "MonitorApi", description = "监控Api")
@RequestMapping("/api/monitor")
public class MonitorController {

    private final MonitorService monitorService;

    @GetMapping()
    @Operation(summary = "获取服务监控面板", security = @SecurityRequirement(name = "authScheme"))
    public ResponseEntity<Object> queryMonitor() {
        Map<String, Object> serverInfo = monitorService.getServerInfo();
        return ResponseEntity.ok(ResponseBody.success(serverInfo));
    }
}
